<?php
/**
 * Created by PhpStorm.
 * User: wuchao
 * Date: 2020/4/15
 * Time: 10:48
 */
namespace app\api\model;

use \Exception;
use think\facade\Db;
use \think\response\Json;

class BannerModel
{
    private static $_table = 'banner'; // banner表
//    private static $_user_address_table = 'user_address'; // 用户地址表
//    private static $_dirverTable = 'dirver'; // 司机表
//    private static $_dirver_routeTable = 'dirver_route'; // 司机路由表

    /**获取Banner
     * @param array $input
     * @return array
     */
    public static function GetBanner($input)
    {
        $data = Db::table(self::$_table)->where('admin_id',$input['admin_id'])->where('status',1)->field('pic,path,sort')->select()->toArray();
        return $data;
    }

    //curl进行Https Get访问链接
    public static function curl_url($url)
    {
        $ch = curl_init();
        //设置选项，包括URL
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HEADER, 0);

        $output = curl_exec($ch); //执行并获取HTML文档内容
        $data = json_decode($output);
        //释放curl句柄
        curl_close($ch);
        return $data;
    }
}